home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-06-19 | 1002 b | 45 lines | [TEXT/MPS ] |
- #define SystemSevenOrLater 1
-
- #include <appleevents.h>
- #include <aliases.h>
- #include <aeregistry.h>
-
- #include "aevent.h"
- #include "aelist.h"
- #include "aeaddress.h"
-
- #include "finderevents.h"
-
- #define findercreator 'MACS'
-
- OSErr tellfindertoopen( const FSSpec& parent, const FSSpec& item )
- {
- AliasHandle alias;
- OSErr error= NewAlias( 0, &item, &alias );
- if (error != noErr)
- return error;
-
- aelist itemlist;
- itemlist.append( typeAlias, (Handle)alias );
- DisposeHandle( (Handle)alias);
- if (itemlist.iswrong())
- return itemlist.whatiswrong();
-
- aeaddress target( findercreator );
- if (target.iswrong())
- return target.whatiswrong();
-
- error= NewAlias( 0, &parent, &alias );
- if (error != noErr)
- return error;
-
- aevent event( kAEFinderEvents, kAEOpenSelection, target );
- event.putparam( keyDirectObject, typeAlias, (Handle)alias );
- event.putparam( keySelection, itemlist );
- DisposeHandle( (Handle)alias );
- if (event.iswrong())
- return event.whatiswrong();
-
- return event.send();
- }
-